import "../../less/index.less"
import $ from "jquery";
import Swipe from "../utils/swipe"
import Vue from "vue"
import "../utils/city/jquery.cityselect";

import com from "../utils/common"

let page = {
  _init:function () {
    let self = this;

    self._loadTemp();
  },
  _appData:{
    SelectHome:"毛坯房",
    SelectProvince:"北京",
    SelectCity:"朝阳区",
    SelectDist:"",
    AddressDetail:""

  },
  _app:{},
  _loadTemp:function () {
    let self = this;
    self._app = new Vue({
      el:"#app",
      data: self._appData,
      methods:{
        Join:function () {

          let JoinData = this.$data;
          for (let Key in JoinData){
            if(JoinData[Key] == "" && Key != "SelectDist"){
              com.alertDialog("所填信息不能为空")
            }
          }
          console.log(JoinData)
          /*com.ajax({
            url:"",
            data:JoinData,
            ok:function (data) {
              console.log(data)
            }
          })*/
        }
      }
    })
    self._afterTemp()
  },
  _afterTemp:function () {
    let self = this;
    $("#chooseplay").citySelect({
      prov: "北京",
      nodata: "none"
    });
    self._swipeImg();
  },
  _swipeImg:function () {

    let imgLength = document.getElementsByClassName("swipe-img").length;
    let bullets = document.getElementById("position").getElementsByTagName("li");
    if (imgLength > 1) {
      for (let i = 0; i < imgLength; i++) {
        let li = $("<li/>").appendTo($("#position"));
      }
      bullets[0].className = "on";
    }
    let elem = document.getElementById("mySwipe");
    Swipe(elem, {
      startSlide: 0,
      auto: 3000,
      continuous: true,
      disableScroll: true,
      stopPropagation: true,
      callback: function (pos) {
        let i = bullets.length;
        while (i--) {
          bullets[i].className = " ";
        }
        bullets[pos].className = "on";
      },
      transitionEnd: function (index, element) {
      }
    });
  }
}

page._init();


